package com.feeyo.prophet.pojo.vo.chart;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
public class BarChart extends Chart{
    /**
     * X轴内容
     */
    @JSONField(name = "xAxis")
    private Axis xAxis;

    /**
     * Y轴内容
     */
    @JSONField(name = "yAxis")
    private List<Axis> yAxis;

    /**
     * 描绘所用数据组
     */
    @JSONField(name = "data")
    private List<Data> data;


    @AllArgsConstructor
    @NoArgsConstructor
    @lombok.Data
    public static class Axis {
        /**
         * 类型
         */
        @JSONField(name = "type")
        private String type;

        /**
         * Y轴标识,name
         */
        @JSONField(name = "name")
        private String name;

        /**
         * 数据format
         */
        @JSONField(name = "formatter")
        private String formatter;

        /**
         * 轴内容
         */
        @JSONField(name = "data")
        private List<String> data;
    }

    @lombok.Data
    public static class Data {
        /**
         * 数据列name
         */
        @JSONField(name = "name")
        private String name;
        /**
         * 数据列type
         */
        @JSONField(name = "type")
        private String type;

        /**
         * 对应Y轴数据索引
         */
        @JSONField(name = "yAxisIndex")
        private int yAxisIndex;

        /**
         * 数据列对应数据数组
         */
        @JSONField(name = "value")
        private List<Double> value;
    }
}


